package com.itany.springcloud.springcloudeurekaopenfeignconsumer.service;

import com.itany.springcloud.springcloudcommon.entity.User;
import com.itany.springcloud.springcloudcommon.vo.ResponseResult;
import com.itany.springcloud.springcloudeurekaopenfeignconsumer.service.fallback.UserServiceFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;

@Service
// @FeignClient("springcloud-eureka-provider")
// @FeignClient(value = "springcloud-eureka-provider",fallback = UserServiceFallback.class)
// @FeignClient(value = "springcloud-eureka-zuul",fallback = UserServiceFallback.class)
@FeignClient(value = "springcloud-eureka-gateway",fallback = UserServiceFallback.class)
public interface UserService {

    // @GetMapping("/user")
    // public ResponseResult findAll();
    //
    // @GetMapping("/user/{id}")
    // public ResponseResult findById(@PathVariable("id") Integer id);
    //
    // @PostMapping("/user")
    // public ResponseResult add(@RequestParam("username") String username,
    //                           @RequestParam("password") String password);
    //
    // @PostMapping("/user/add2")
    // public ResponseResult add2(@RequestBody User user);
    //
    // //org.springframework.cloud:spring-cloud-starter-openfeign 2.1以后使用
    // // @PostMapping("/user/add3")
    // // public ResponseResult add3(@SpringQueryMap User user);
    //
    // @DeleteMapping("/user/{id}")
    // public ResponseResult remove(@PathVariable("id") Integer id);
    //
    // @PutMapping("/user")
    // public ResponseResult modify(@RequestParam("id") Integer id,
    //                              @RequestParam("username") String username,
    //                              @RequestParam("password") String password);







    // @GetMapping("/ums/userService/user")
    // public ResponseResult findAll();
    //
    // @GetMapping("/ums/userService/user/{id}")
    // public ResponseResult findById(@PathVariable("id") Integer id);
    //
    // @PostMapping("/ums/userService/user")
    // public ResponseResult add(@RequestParam("username") String username,
    //                           @RequestParam("password") String password);
    //
    // @PostMapping("/ums/userService/user/add2")
    // public ResponseResult add2(@RequestBody User user);
    //
    // //org.springframework.cloud:spring-cloud-starter-openfeign 2.1以后使用
    // // @PostMapping("/ums/userService/user/add3")
    // // public ResponseResult add3(@SpringQueryMap User user);
    //
    // @DeleteMapping("/ums/userService/user/{id}")
    // public ResponseResult remove(@PathVariable("id") Integer id);
    //
    // @PutMapping("/ums/userService/user")
    // public ResponseResult modify(@RequestParam("id") Integer id,
    //                              @RequestParam("username") String username,
    //                              @RequestParam("password") String password);



    @GetMapping("/ums/user")
    public ResponseResult findAll();

    @GetMapping("/ums/user/{id}")
    public ResponseResult findById(@PathVariable("id") Integer id);

    @PostMapping("/ums/user")
    public ResponseResult add(@RequestParam("username") String username,
                              @RequestParam("password") String password);

    @PostMapping("/ums/user/add2")
    public ResponseResult add2(@RequestBody User user);

    //org.springframework.cloud:spring-cloud-starter-openfeign 2.1以后使用
    // @PostMapping("/ums/userService/user/add3")
    // public ResponseResult add3(@SpringQueryMap User user);

    @DeleteMapping("/ums/user/{id}")
    public ResponseResult remove(@PathVariable("id") Integer id);

    @PutMapping("/ums/user")
    public ResponseResult modify(@RequestParam("id") Integer id,
                                 @RequestParam("username") String username,
                                 @RequestParam("password") String password);


}



